package org.bmind.datasword.config.dto;

import java.util.ArrayList;
import java.util.Collection;

import javax.xml.bind.annotation.XmlElement;

import org.bmind.datasword.utils.EqualsUtil;
import org.bmind.datasword.utils.HashCodeUtil;
import org.bmind.datasword.utils.StorageUtilities;

public class DPreProcFunction extends DObjCommon{
	static { StorageUtilities.addREngineType(DPreProcFunction.class); }
	private int fHashCode;
	private DPreProcFunctionType fType = null;

	public DPreProcFunction() {super();}
	
	public DPreProcFunctionType getfType() {return fType;}
	//@XmlElement
	public void setfType(DPreProcFunctionType fType) {this.fType = fType;}
	
	/* (non-Javadoc)
	     * @see org.bmind.datasword.config.dto.DObjCommon#equals(java.lang.Object)
	     */
	    @Override
	    public boolean equals(Object obj) {
	        if ( this == obj ) return true;
	 	    if ( !(obj instanceof DPreProcFunction) ) return false;
	 	   
	 	   DPreProcFunction dPp = (DPreProcFunction)obj;
	 	    
	     	return	EqualsUtil.areEqual(this.dEngineType, dPp.dEngineType) &&
	     			EqualsUtil.areEqual(this.dFunction, dPp.dFunction) &&
	     			EqualsUtil.areEqual(this.hint, dPp.hint) &&
	     			EqualsUtil.areEqual(this.label, dPp.label) &&
	     			EqualsUtil.areEqual(this.Library, dPp.Library) &&
	     			EqualsUtil.areEqual(this.exec, dPp.exec) &&
	     			EqualsUtil.areEqual(this.fParameter, dPp.fParameter) &&
	     			EqualsUtil.areEqual(this.name , dPp.name) &&
	     			EqualsUtil.areEqual(this.visible, dPp.visible) &&
	     			EqualsUtil.areEqual(this.getAreas(), dPp.getAreas()) &&
	     			EqualsUtil.areEqual(this.getRoles(), dPp.getRoles()) &&
	     			EqualsUtil.areEqual(this.getID(), dPp.getID()) &&
	     			EqualsUtil.areEqual(this.getNextId(), dPp.getNextId()) &&
	     			EqualsUtil.areEqual(this.getPreviusId(), dPp.getPreviusId()) &&
	     			EqualsUtil.areEqual(this.getVersion(), dPp.getVersion());
	     			
	    }
	
		/* (non-Javadoc)
	     * @see org.bmind.datasword.config.dto.DObjCommon#hashCode()
	     */
		@Override
		public int hashCode() {
			
			// this style of lazy initialization is
			// suitable only if the object is immutable
			if (fHashCode == 0) {
			int result = HashCodeUtil.SEED;
				result = HashCodeUtil.hash(result, dEngineType);
				result = HashCodeUtil.hash(result, dFunction);
				result = HashCodeUtil.hash(result, hint);
				result = HashCodeUtil.hash(result, label);
				result = HashCodeUtil.hash(result, Library);
				result = HashCodeUtil.hash(result, exec);
				result = HashCodeUtil.hash(result, fParameter);
				result = HashCodeUtil.hash(result, name);
				result = HashCodeUtil.hash(result, visible);
				result = HashCodeUtil.hash(result, getAreas());
				result = HashCodeUtil.hash(result, getRoles());
				result = HashCodeUtil.hash(result, getID());
				result = HashCodeUtil.hash(result, getNextId());
				result = HashCodeUtil.hash(result, getPreviusId());
				result = HashCodeUtil.hash(result, getVersion());
				
				fHashCode = result;
			}
			return fHashCode;
		}
	
	
	

}
